﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace dzs.Web.tenderExpert
{
    public partial class RandomExpertCheck : System.Web.UI.Page
    {
        Maticsoft.BLL.expertConfirm excm = new Maticsoft.BLL.expertConfirm();
        Maticsoft.BLL.superviseConfirm sm = new Maticsoft.BLL.superviseConfirm();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["login"] != null)
                {
                    DataSet ds = Session["login"] as DataSet;
                    int user_id = int.Parse(ds.Tables[0].Rows[0]["user_id"].ToString());

                    Bind(user_id);
                }
           
                
            }
        }

        private void Bind(int superviseId)
        {
            DataSet ds = excm.GetList(" status = 0 and superviseId = " + superviseId);

            this.gridView.DataSource = ds;
            this.gridView.DataBind();
        
        }
        //同意抽选结果
        protected void btn_yes_Click(object sender, EventArgs e)
        {
            if (Session["login"] != null)
            {
                DataSet ds = Session["login"] as DataSet;
                int user_id = int.Parse(ds.Tables[0].Rows[0]["user_id"].ToString());

                if (excm.UpdateStatus(" superviseId="+ user_id +" and status = 0 ", 1))
                {
                    Maticsoft.Common.MessageBox.Show(this.Page, "操作成功！");
                }
            }

          
        }
        //不同意抽选结果
        protected void btn_no_Click(object sender, EventArgs e)
        {
            if (Session["login"] != null)
            {
                DataSet ds = Session["login"] as DataSet;
                int user_id = int.Parse(ds.Tables[0].Rows[0]["user_id"].ToString());

                if (excm.UpdateStatus(" superviseId=" + user_id + " and status = 0 ", 2))
                {
                    Maticsoft.Common.MessageBox.Show(this.Page, "操作成功！");
                }
            }
        }

        protected void Timer1_Tick(object sender, EventArgs e)
        {
            if (Session["login"] != null)
            {
                DataSet ds = Session["login"] as DataSet;
                int user_id = int.Parse(ds.Tables[0].Rows[0]["user_id"].ToString());

                Bind(user_id);
            }
        }
      
    }
}